/**
 *====================================================
 * 文件名称: FinanceCreditReplenishContainerServiceImpl.java
 * 修订记录：
 * No    日期				作者(操作:具体内容)
 * 1.    2016年03月24日	chenxy(创建:创建文件)
 *====================================================
 * 类描述：(说明未实现或其它不应生成javadoc的内容)
 */
package com.yuexunit.finance.project.service;

import java.util.ArrayList;
import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Restrictions;

import com.yuexunit.finance.project.entity.FinanceCreditReplenishContainerEntity;
import com.yuexunit.inject.annotation.Implements;
import com.yuexunit.persist.PersistUtil;

/**
 * @ClassName: FinanceCreditReplenishContainerServiceImpl
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @author chenxy
 * @date 2016年03月24日 14:17:43
 */
@Implements(FinanceCreditReplenishContainerService.class)
public class FinanceCreditReplenishContainerServiceImpl implements FinanceCreditReplenishContainerService {

	@Override
	public void createFinanceCreditReplenishContainer(FinanceCreditReplenishContainerEntity entity) {
		PersistUtil.insert(entity);
	}

	@Override
	public void renovateFinanceCreditReplenishContainer(FinanceCreditReplenishContainerEntity persist) {
		PersistUtil.update(persist);
	}

	@Override
	public void removeFinanceCreditReplenishContainer(FinanceCreditReplenishContainerEntity persist) {
		PersistUtil.delete(persist);
	}

	@Override
	public List<FinanceCreditReplenishContainerEntity> inquireCreditReplenishContainerList(Long creditId) {
		DetachedCriteria criteria = DetachedCriteria.forClass(FinanceCreditReplenishContainerEntity.class);
		criteria.add(Restrictions.eq("creditId", creditId));
		return PersistUtil.get(criteria);
	}

	@Override
	public List<FinanceCreditReplenishContainerEntity> inquireCreditReplenishContainerList(Long[] inventoryIds) {
		List<FinanceCreditReplenishContainerEntity> creditReplenishContainerList = new ArrayList<FinanceCreditReplenishContainerEntity>();
		for(long inventoryId : inventoryIds){
			FinanceCreditReplenishContainerEntity existed = PersistUtil.get(FinanceCreditReplenishContainerEntity.class, inventoryId);
			creditReplenishContainerList.add(existed);
		}

		return creditReplenishContainerList;
	}
}
